package com.study.train.common.resp;

import lombok.Data;

@Data
public class CommonResp {

    /**
     * 业务上的成功或失败
     */
    private boolean success = true;

    /**
     * 返回信息
     */
    private String message;

    /**
     * 返回泛型数据，自定义类型
     */
    private Object content;

    public CommonResp() {
    }

    public CommonResp(boolean success, String message, Object content) {
        this.success = success;
        this.message = message;
        this.content = content;
    }

    public static CommonResp success(){
        return new CommonResp(true, "请求成功", null);
    }

    public static CommonResp success(Object content){
        return new CommonResp(true, "请求成功", content);
    }
    public static CommonResp fail(){
        return new CommonResp(false, "请求失败", null);
    }

    public static CommonResp fail(String message){
        return new CommonResp(false, message, null);
    }

}
